package com.woniu.exception;

import com.woniu.util.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

    @ExceptionHandler(CheckException.class)
    public Result handBusinessException(CheckException e) {
        log.error(e.getMessage());
        e.printStackTrace();
        return Result.bulid().setCode(e.getCode()).setMessage(e.getMessage());
    }

}
